﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Se.Framework.Common.Extentions
{
    public static class DictionaryExtentions
    {
        public static TValue GetValueOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dict, TKey key, TValue defaultValue)
        {
            if (dict.ContainsKey(key))
            {
                TValue res = dict[key];
                return res == null ? defaultValue : res;
            }
            return defaultValue;
        }
    }
}